answer "You must enter the bank's closing balance before you "& "attempt to reconcile your checking account."
get the loc of bg fld "closingBal"
click at it
exit mouseup
end if
set lockscreen to true
go cd "main"
put bg fld "balance" into curBal
go cd "reconcile"
global match
set numberformat to "0.00"
-- CLEAR CHECKS
if bg fld "cleared" is not empty then
put 1 into x
repeat for the number of lines in bg fld "cleared"
set cursor to busy
put 0 into lastPos
put line x of bg fld "cleared" into checkNum
set lockscreen to true
go cd "checkList"
put find (bg fld "checkList",match & checkNum) into lastPos
if item 1 of lastPos is not 0 then
if item 2 of line (item 1 of lastPos) of bg fld "checkList" = checkNum then
put "1" into item 5 of line (item 1 of lastPos) of bg fld "checkList"
go cd "reconcile"
delete line x of bg fld "cleared"
end if
else
go cd "reconcile"
put x + 1 into x
end if
end repeat
if bg fld "cleared" is not empty then
-- CLEAR DEPOSITS
put 1 into x
repeat for the number of lines in bg fld "cleared"
set cursor to busy
put 0 into lastPos
put line x of bg fld "cleared" into checkNum
set lockscreen to true
go cd "deposits"
put find (bg fld "deposit",match & checkNum) into lastPos
if item 1 of lastPos is not 0 then
if item 2 of line (item 1 of lastPos) of bg fld "deposit" = checkNum then
put "1" into item 5 of line (item 1 of lastPos) of bg fld "deposit"
go cd "reconcile"
delete line x of bg fld "cleared"
end if
else
go cd "reconcile"
put x + 1 into x
end if
end repeat
end if
end if
if bg fld "cleared" is not empty then
play harpsichord c6
answer "Some items were not cleared or were not found in your "& "check register."
end if
-- LIST OUTSTANDING CHECKS
set lockscreen to true
go cd "checkList"
put 1 into x
repeat for the number of lines in bg fld "checklist"
set cursor to busy
if item 5 of line x of bg fld "checklist" is "0" then
put item 2 of line x of bg fld "checklist" & "," & item 4 of line x of bg fld "checklist" & return after tempList
end if
put x + 1 into x
end repeat
go cd "reconcile"
put templist into bg fld "cksOut"
-- ADDING OUTSTANDING CHECKS
put 0 into subtotal
put 1 into x
repeat for the number of lines in bg fld "cksOut"
add item 2 of line x of bg fld "cksOut" to subtotal
put x + 1 into x
end repeat
put subtotal into bg fld "cksOutTotal"
put subtotal into bg fld "cksOutstanding"
-- LISTING OUTSTANDING DEPOSITS
put 0 into subtotal
put empty into tempList
put 1 into x
go cd "deposits"
repeat for the number of lines in bg fld "deposit"
set cursor to busy
if item 5 of line x of bg fld "deposit" is "0" then
put item 2 of line x of bg fld "deposit" & "," & item 4 of line x of bg fld "deposit" & return after tempList
end if
put x + 1 into x
end repeat
go cd "reconcile"
put templist into bg fld "newDeposits"
put 1 into x
repeat for the number of lines in bg fld "newDeposits"
add item 2 of line x of bg fld "newDeposits" to subtotal
put x + 1 into x
end repeat
put subtotal into bg fld "newDepositsTotal"
-- BANK BALANCE & DEPOSITS
put bg fld "closingBal" into bal
put bg fld "newDepositsTotal" into bg fld "newDeps"
put bg fld "newDepositsTotal" + bal into bg fld "subtotal"
put "$" & bg fld "subtotal" - bg fld "cksOutstanding" into bg fld "balance"
if bg fld "subtotal" - bg fld "cksOutstanding" = curBal then
play "hallelujah"
answer "Congratulations! Your account has been reconciled!"
put the short date into bg fld "lastRec"
put empty into bg fld "out"
else
play "oops"
put (bg fld "subtotal" - bg fld "cksOutstanding") - curBal into temp
answer "Your account is out of balance by $" & temp & ". Make sure you've cancelled the correct items and that check "& "amounts are entered correctly. Press the PANIC button for more help."
put "OUT OF BALANCE BY $" & temp into bg fld "out"